package com.zgz.underwrite.model;

import java.io.Serializable;
import java.sql.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;


/**
 * 投保单
 * @author zgz
 *
 */
@Entity
@Table(name="insuranceApp")
public class InsuranceApplication implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4327034759564372896L;
	@Id
	@GeneratedValue(generator = "paymentableGenerator")     
	@GenericGenerator(name = "paymentableGenerator", strategy = "assigned")
	private String SAppNo;//投保单号
	private Date DAppTm;//投保日期
	private Date DBgnTm;//保险起期
	private Date DEndTm;//保险止期 
	
	private String SShortTermCoef;//短期费率
	private Double NTotalPremium;//保费总计
	
	@ManyToOne
	@JoinColumn(name="businessMan")
	private Employee businessMan;//业务员
	
	@ManyToOne
	@JoinColumn(name="entering")
	private Employee entering;//录单员
	
	private Date DFillAppTm;//录单日期

	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="SVehicleId")
	private Vehicle vehicle;//车辆信息
	
	@ManyToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="SApplicantId",nullable=false)
	private Applicant applicant;//投保人
	
	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="SInsurantId")
	private Insurant insurant;//被保人
	
	@ManyToOne
	@JoinColumn(name="department")
	private Department department;//机构
	
	@ManyToOne
	@JoinColumn(name="product")
	private Product product;//产品
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="insuranceApp",fetch=FetchType.EAGER)
	private Set<InsuredCvrg> insuredCvrg; //投保险别
	
	@ManyToMany
	@JoinTable(
			name="insuranceapp_spec",
			joinColumns=@JoinColumn(name="SAppNo"),
			inverseJoinColumns=@JoinColumn(name="SSpecCvtNo")
	)
	private Set<SpecialConvention> specConventions;//特别约定
	
	@OneToOne(cascade=CascadeType.ALL)
	@JoinColumn(name="premiumCoef")
	private PremiumCoef premiumCoef;//优惠系数
	
	private String status = "未申请核保";//状态
	
	private String SPassedUdrResult;//通过核保结果
	private String SNotPassedUdrResult;//不通过核保结果
	private String SMinLevel;//最低核保权限
	
	public String getSAppNo() {
		return SAppNo;
	}
	public void setSAppNo(String appNo) {
		SAppNo = appNo;
	}
	
	public String getSShortTermCoef() {
		return SShortTermCoef;
	}
	public void setSShortTermCoef(String shortTermCoef) {
		SShortTermCoef = shortTermCoef;
	}
	public Double getNTotalPremium() {
		return NTotalPremium;
	}
	public void setNTotalPremium(Double totalPremium) {
		NTotalPremium = totalPremium;
	}
	public Employee getBusinessMan() {
		return businessMan;
	}
	public void setBusinessMan(Employee businessMan) {
		this.businessMan = businessMan;
	}
	public Employee getEntering() {
		return entering;
	}
	public void setEntering(Employee entering) {
		this.entering = entering;
	}

	public Vehicle getVehicle() {
		return vehicle;
	}
	public void setVehicle(Vehicle vehicle) {
		this.vehicle = vehicle;
	}

	public Department getDepartment() {
		return department;
	}
	public void setDepartment(Department department) {
		this.department = department;
	}
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}


	public void setPremiumCoef(PremiumCoef premiumCoef) {
		this.premiumCoef = premiumCoef;
	}
	public PremiumCoef getPremiumCoef() {
		return premiumCoef;
	}
	public void setSpecConventions(Set<SpecialConvention> specConventions) {
		this.specConventions = specConventions;
	}
	public Set<SpecialConvention> getSpecConventions() {
		return specConventions;
	}
	public void setApplicant(Applicant applicant) {
		this.applicant = applicant;
	}
	public Applicant getApplicant() {
		return applicant;
	}
	public void setInsurant(Insurant insurant) {
		this.insurant = insurant;
	}
	public Insurant getInsurant() {
		return insurant;
	}
	public void setInsuredCvrg(Set<InsuredCvrg> insuredCvrg) {
		this.insuredCvrg = insuredCvrg;
	}
	public Set<InsuredCvrg> getInsuredCvrg() {
		return insuredCvrg;
	}


	public void setDAppTm(Date dAppTm) {
		DAppTm = dAppTm;
	}
	public Date getDAppTm() {
		return DAppTm;
	}
	public void setDBgnTm(Date dBgnTm) {
		DBgnTm = dBgnTm;
	}
	public Date getDBgnTm() {
		return DBgnTm;
	}
	public void setDEndTm(Date dEndTm) {
		DEndTm = dEndTm;
	}
	public Date getDEndTm() {
		return DEndTm;
	}

	public void setStatus(String status) {
		this.status = status;
	}
	public String getStatus() {
		return status;
	}
	public void setSPassedUdrResult(String sPassedUdrResult) {
		SPassedUdrResult = sPassedUdrResult;
	}
	public String getSPassedUdrResult() {
		return SPassedUdrResult;
	}
	public void setSNotPassedUdrResult(String sNotPassedUdrResult) {
		SNotPassedUdrResult = sNotPassedUdrResult;
	}
	public String getSNotPassedUdrResult() {
		return SNotPassedUdrResult;
	}
	public void setSMinLevel(String sMinLevel) {
		SMinLevel = sMinLevel;
	}
	public String getSMinLevel() {
		return SMinLevel;
	}
	public void setDFillAppTm(Date dFillAppTm) {
		DFillAppTm = dFillAppTm;
	}
	public Date getDFillAppTm() {
		return DFillAppTm;
	}

}
